import { GoodsParams, GoodsPageParams, GoodsPageListGetResultModel } from './goodsModel';

import { defHttp } from '/@/utils/http/axios';

enum Api {
  // GoodsList = '/company/getGoodsList',
  GoodsPageList = '/company/pageCompanyGoods',
  SaveOrUpdateGoods = '/company/saveOrUpdateGoods',
  DeleteGoods = '/company/deleteCompanyGoods',
}

// export const getGoodsList = (params: GoodsParams) =>
//   defHttp.get<GoodsListGetResultModel>({ url: Api.GoodsList, params });

export const getGoodsListByPage = (params?: GoodsPageParams) =>
  defHttp.get<GoodsPageListGetResultModel>({ url: Api.GoodsPageList, params });

export const saveOrUpdateGoods = (params?: GoodsParams) =>
  defHttp.post({ url: Api.SaveOrUpdateGoods, params }, { errorMessageMode: 'modal' });

export const delById = (id: number) => defHttp.post({ url: Api.DeleteGoods + `/${id}` });
